//启动一个服务, 接受post请求, 并打印服务接收到的内容
const http = require('http');
const server = http.createServer((req, res) => {
  if (req.method === 'POST') {
    let body = '';
    req.on('data', chunk => {
      body += chunk.toString();
    });
    req.on('end', () => {
      console.log(body);
      res.end('ok');
    });
  } else {
    res.end('not support');
  }
});
server.listen(3000, () => {
  console.log('server is running at http://localhost:3000');
});
